﻿<%@ Page Language="C#" MasterPageFile="~/Manage/MainPage.master"  AutoEventWireup="true" CodeFile="GoodsManage.aspx.cs" Inherits="Manage_GoodsManage" %>
<%@ Import Namespace="Shopping.Common" %>
<%@ Import Namespace="Shopping.Model" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
<script type="text/javascript" src="/FckEditor/fckeditor.js"></script> 
<script type="text/javascript" src="/JsBase/swfupload/swfupload.js"></script> 
<script type="text/javascript" src="/JsBase/swfupload/SwfUploadHelper.js"></script> 
<script type="text/javascript" src="/Manage/Js/GoodsManage.js"></script>
<script type="text/javascript" src="/Manage/Public/SelectGoods.js"></script>
<script type="text/javascript">
    SelectOptionOfCategory = '<%=SelectOptionOfCategory %>';
    SelectOptionOfPackUnit ='<%=SelectOptionOfPackUnit %>';
    SelectOptionOfGoodsUnit = '<%=SelectOptionOfGoodsUnit %>';
    SelectOptionOfSaleStatus ='<%=SelectOptionOfSaleStatus %>';
    SelectOptionOfPlace = '<%=SelectOptionOfPlace %>';
    SelectOptionOfSpecialArea ='<%=SelectOptionOfSpecialArea %>';
    CheckOptionOfCommend ='<%=CheckOptionOfCommend %>';
    SessionID = '<%=Session.SessionID %>';
    ModelOfGoods =<%=JSONHelper.ObjectToJson<GoodsInfo>(new GoodsInfo()) %>;
    ModelOfPriceRule =<%=new GoodsPriceRules().ToJsonString() %>;
    ModelOfGoodsPicture =<%=new GoodsPictures().ToJsonString() %>;
    ModelOfIDNameObj= <%= new IDNameObj().ToJsonString() %>;
    ModelOfOnSale = <%=JSONHelper.ObjectToJson<GoodsOnSalesInfo>(new GoodsOnSalesInfo()) %>;
</script>
 
<table width="99%" border="0" cellspacing="0" cellpadding="0" class="table" align="center">
  <tr>
    <td align="center"><img src="/Manage/Images/sousuo.gif" />商品名称：
      <input name="txtKeyWords" type="text" id="txtKeyWords" size="20" value="<%=p.KeyWords %>"  class="border6"/>
&nbsp;分类：
<select name="ddlCategoryOfSearch" id="ddlCategoryOfSearch" onchange="GetBrands(this.options[this.selectedIndex].value,'ddlBrandOfSearch');">
  <option value="">----不限---</option>
  <%=SelectOptionOfCategory %>
</select> 
品牌：
<select name="ddlBrandOfSearch" id="ddlBrandOfSearch">
  <option value="">----不限---</option>
  <%=SelectOptionOfBrand%>
</select>&nbsp;产地：
<select name="ddlPlaceOfSearch" id="ddlPlaceOfSearch">
  <option value="">--不限--</option>
  <%=SelectOptionOfPlace %>
</select>
销售状态：
<select name="ddlSaleStatusOfSearch" id="ddlSaleStatusOfSearch">
  <option value="">--不限--</option>
  <%=SelectOptionOfSaleStatus %>
</select>
状态：
<select name="ddlStatusOfSearch" id="ddlStatusOfSearch">
  <option value="">--全部--</option>
  <option value="正用" <%=p.Status == Status.正用.ToString()?"Selected":"" %>>正用</option>
  <option value="停用" <%=p.Status == Status.停用.ToString()?"Selected":"" %>>停用</option>
</select>
<input name="btnSearch" type="button" id="btnSearch" value="执行搜索" class="btn2"  onclick="GoToSearch();"/>

      [ <a href="GoodsManage.aspx" class="red bold">查看全部</a> ] </td>
  </tr>
</table>
  <br />
<table width="99%" border="0" cellspacing="0" cellpadding="0" class="table" align="center">
  <tr>
    <td colspan="11" align="left"  class="HeadTitle">&gt;&gt;商品列表</td>
  </tr>
  <tr  class="TableHeadRow">
    <td width="50" align="center">序号</td>
    <td align="left">商品名称</td>
    <td width="60" align="center">库存<a href="<%=Utility.GetNewUrl("Sorts","11",false) %>">↓</a><a href="<%=Utility.GetNewUrl("Sorts","12",false) %>">↑</a></td>
    <td width="70" align="center">售价<a href="<%=Utility.GetNewUrl("Sorts","5",false) %>">↓</a><a href="<%=Utility.GetNewUrl("Sorts","6",false) %>">↑</a></td>
    <td width="80" align="center">品牌</td>
    <td width="100" align="center">商品分类</td>
    <td width="65" align="center">点击量<a href="<%=Utility.GetNewUrl("Sorts","3",false) %>">↓</a><a href="<%=Utility.GetNewUrl("Sorts","4",false) %>">↑</a></td>
    <td width="100" align="center">上/下架日期</td>
    <td width="50" align="center">状态</td>
    <td width="120" align="center">创建日期<a href="<%=Utility.GetNewUrl("Sorts","1",false) %>">↓</a><a href="<%=Utility.GetNewUrl("Sorts","2",false) %>">↑</a></td>
    <td width="120" align="center">管理 [<a href="javascript:Add();" class="red">+添加</a>] </td>
  </tr>

  <%
      if (listOfGoods != null)
      {
          for (int i = 0; i < listOfGoods.Count; ++i)
          {
              GoodsInfo g = listOfGoods[i];
   %>
  <tr  onmouseover="this.style.backgroundColor='#F2F2F2';" onmouseout="this.style.backgroundColor='#FFFFFF';">
    <td align="center"><%=(p.CurPage-1)*p.PageSize +i+1 %>.</td>
    <td align="left"><a href="javascript:Edit(<%=g.BaseInfo.GoodsID %>);"><%=g.BaseInfo.GoodsName %></a> 
    <%
        if (!string.IsNullOrEmpty(g.BaseInfo.Promotions))
        { 
    %>
    (<span class="red"><%=g.BaseInfo.Promotions %></span>) 
    
    <%} %>
    <%
        if (g.BaseInfo.GiveScores > 0)
        {
       %>
    [<span class="red">赠<%=g.BaseInfo.GiveScores %>积分</span>] 
    <%} %>
     [<a href="/Goods/<%=g.BaseInfo.GoodsID %>.html" target="_blank" class="green">查看</a>]
    </td>
    <td align="center">
    <% if (g.Stocks <= 10)
       {
           Response.Write("<span class=\"red\">" + g.Stocks + "</span>");
       }
       else
       {
           Response.Write("<span class=\"green\">" + g.Stocks + "</span>");
       }        
       %></td>
    <td align="center"><%= g.BaseInfo.SalePrice.ToString("C") %></td>
    <td align="center"><a href="<%=Utility.GetNewUrl("BrandID",g.BaseInfo.BrandID.ToString(),false) %>" title="查看该品牌下的所有商品"><%=g.BrandName%></a></td>
    <td align="center"><a href="<%=Utility.GetNewUrl("CategoryID",g.BaseInfo.CategoryID.ToString(),false) %>" title="查看该分类下的所有商品"><%=g.CategoryName %></a></td>
    <td align="center" class="green bold"><%=g.BaseInfo.Clicks %></td>
    <td align="center"><%=g.上下架日期 %></td>
    <td align="center" class="green"><%=g.BaseInfo.SaleStatus %></td>
    <td align="center"><%=g.BaseInfo.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") %></td>
    <td align="center"> [<a href="javascript:Edit(<%=g.BaseInfo.GoodsID %>);">编辑</a>] [<a href="javascript:Delete(<%=g.BaseInfo.GoodsID %>);" class="red">删除</a>] </td>
  </tr>
    <% } %>
  <tr>
    <td colspan="11" align="center">
    <span class="page" >
       <%=Utility.GetPageLine(Utility.GetWebPageUrlNoCurPage(), p.CurPage, p.PageSize,10, p.TotalCount)%>    
        </span>
        </td>
    </tr>

    <%}
      else
      { %>
  <tr>
    <td colspan="11" align="center"><span class="red">[ 未找到任何商品信息！]</span></td>
    </tr>
    <%} %>
</table>

</asp:Content>
